﻿Shader "Custom/PixelBased" {
	Properties {
        _MainTex ("Atlas Texture", 2D) = "white" {}
        _pixelSX ("像素化系数", RANGE(0.00001, 0.05)) = 0.01
        _pixelSY ("像素化系数", RANGE(0.00001, 0.05)) = 0.01       
    }    
    CGINCLUDE
    #include "UnityCG.cginc"
	sampler2D _MainTex;
	fixed _pixelSX;
	fixed _pixelSY;
	fixed4 frag (v2f_img i) : COLOR {
		fixed2 uv = fixed2 (_pixelSX * ceil (i.uv.x / _pixelSX), _pixelSY * ceil (i.uv.y/ _pixelSY)); 
		return tex2D (_MainTex, uv);
	}
	ENDCG
    SubShader {
        Tags {
        	"Queue"="Transparent" 
        	"IgnoreProjector"="True" 
        	"RenderType"="Transparent" 
        }
        Cull Off Lighting Off ZWrite Off 
        Fog { Mode Off }
        Blend SrcAlpha OneMinusSrcAlpha
        Pass {
        	CGPROGRAM
        	#pragma vertex vert_img
			#pragma fragment frag
			ENDCG
        }
    }
	FallBack "Diffuse"
}
